local WaitCheatingLayer = class("WaitCheatingLayer", require "widget/BaseUI")

function WaitCheatingLayer.show()
    print("============WaitCheatingLayer.show===============")

    local win = WaitCheatingLayer.new()

    local data = getWndInitParamList()
    data.isRemoveResource = false
    data.imgTitle = nil
    data.bgImage = nil
    data.isShowCover = false,

    win:init(data)
    win:showWindow()

    return win

end

function WaitCheatingLayer:ctor() 
    WaitCheatingLayer.super:ctor();
end


function WaitCheatingLayer:init(data)
    self:initWithParas(data)
    self.m_Json = ccs.GUIReader:getInstance():widgetFromJsonFile("image/ui/Json/LayerWait_Cheating.json")
    local WinSize = cc.Director:getInstance():getWinSize()
    self.m_Json:setScaleX(WinSize.width/self.m_Json:getContentSize().width)
    self.m_Json:setScaleY(WinSize.height/self.m_Json:getContentSize().height)
    self:addChild(self.m_Json)

    local x = WinSize.width - self:getContentSize().width 
    local y = WinSize.height - self:getContentSize().height 
    self:setPositionX(x/2)
    self:setPositionY(y/2)
   
    self.m_BtnEnter = self.m_Json:getChildByName("bt_Enter")
    self.m_BtnEnter:setTouchEnabled(true)
    self.m_BtnEnter:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end) 
     
    self.m_BtnBack = self.m_Json:getChildByName("lu_bt_back")
    self.m_BtnBack:setTouchEnabled(true)
    self.m_BtnBack:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
 
   
  
end


function WaitCheatingLayer:onMenutClick(sender,eventType)
    if eventType == ccui.TouchEventType.ended then
        if sender == self.m_BtnEnter then     
            print "=========SetLayer:onMenutClick m_BtnEnter======================="
        elseif sender == self.m_BtnBack then     
            print "=========SetLayer:onMenutClick m_BtnBack======================="
            self:closeWindow()
        end
    end
end
 
return WaitCheatingLayer